window.onload = function () {
    var xhr = new XMLHttpRequest();
    xhr.open('get', 'http://localhost:8888/goods/list');
    xhr.send();
    xhr.onreadystatechange = function() {
        if(xhr.readyState === 4) {
            if(parseInt(xhr.status / 100) === 2) {
                var res = xhr.responseText;
                console.log(res);
                res = JSON.parse(res);
                console.log(res);
                var {code, list} = res;
                if(code === 1) {
                    for(var a = 0; a < list.length; a++) {
                        var data = list[a].data;
                        var str = ''
                        for(var x = 0; x < data.length; x++) {
                            str += `
                                1: ${data[x].t}
                                2: ${data[x].img}
                            `
                        }
                        console.log(str);
                    }
                }
            }
        }
    }
}